home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / kdiskfreesp.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-10-10  |  2.8 KB  |  90 lines

  1. /*
  2.  * kdiskfreesp.h
  3.  *
  4.  * Copyright (c) 1999 Michael Kropfberger <michael.kropfberger@gmx.net>
  5.  *
  6.  * Requires the Qt widget libraries, available at no cost at
  7.  * http://www.troll.no/
  8.  *
  9.  *
  10.  *  This library is free software; you can redistribute it and/or
  11.  *  modify it under the terms of the GNU Library General Public
  12.  *  License version 2 as published by the Free Software Foundation.
  13.  *
  14.  *  This library is distributed in the hope that it will be useful,
  15.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  16.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  17.  *  Library General Public License for more details.
  18.  *
  19.  *  You should have received a copy of the GNU Library General Public License
  20.  *  along with this library; see the file COPYING.LIB.  If not, write to
  21.  *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  22.  *  Boston, MA 02110-1301, USA.
  23.  */
  24.  
  25.  
  26. #ifndef __KDISKFREESP_H__
  27. #define __KDISKFREESP_H__
  28.  
  29. #include <qobject.h>
  30. #include <qstring.h>
  31.  
  32. #include <kdelibs_export.h>
  33.  
  34. class KProcess;
  35.  
  36. /**
  37.  * This class parses the output of "df" to find the disk usage
  38.  * information for a given partition (mount point).
  39.  */
  40. class KIO_EXPORT KDiskFreeSp : public QObject
  41. {  Q_OBJECT
  42. public:
  43.    KDiskFreeSp( QObject *parent=0, const char *name=0 );
  44.    /**
  45.     * Destructor - this object autodeletes itself when it's done
  46.     */
  47.    ~KDiskFreeSp();
  48.    /**
  49.     * Call this to fire a search on the disk usage information
  50.     * for @p mountPoint. foundMountPoint will be emitted
  51.     * if this mount point is found, with the info requested.
  52.     * done is emitted in any case.
  53.     */
  54.    int readDF( const QString & mountPoint );
  55.  
  56.    /**
  57.     * Call this to fire a search on the disk usage information
  58.     * for the mount point containing @p path.
  59.     * foundMountPoint will be emitted
  60.     * if this mount point is found, with the info requested.
  61.     * done is emitted in any case.
  62.     */
  63.    static KDiskFreeSp * findUsageInfo( const QString & path );
  64.  
  65. signals:
  66.    void foundMountPoint( const QString & mountPoint, unsigned long kBSize, unsigned long kBUsed, unsigned long kBAvail );
  67.  
  68.    // This one is a hack around a weird (compiler?) bug. In the former signal,
  69.    // the slot in KPropsDlg would get 0L, 0L as the last two parameters.
  70.    // When using const ulong& instead, all is ok.
  71.    void foundMountPoint( const unsigned long&, const unsigned long&, const unsigned long&, const QString& );
  72.    void done();
  73.  
  74. private slots:
  75.    void receivedDFStdErrOut(KProcess *, char *data, int len);
  76.    void dfDone();
  77.  
  78. private:
  79.   KProcess         *dfProc;
  80.   QCString          dfStringErrOut;
  81.   QString           m_mountPoint;
  82.   bool              readingDFStdErrOut;
  83.   class KDiskFreeSpPrivate;
  84.   KDiskFreeSpPrivate * d;
  85. };
  86. /***************************************************************************/
  87.  
  88.  
  89. #endif
  90.